using System;
using System.Collections.Generic;

using EntModApp.EntServices.Data;

namespace DemoApp.DataAccess 
{
  public static class RolePropertyNames
  {
    public const string RoleId = @"RoleId"; 

    public const string Name = @"Name"; 

    public const string IsAdmin = @"IsAdmin"; 

  }

  public static class RoleReferenceNames
  {
    public const string SecurableActions = @"SecurableActions"; 

    public const string Users = @"Users"; 

  }

  [Serializable]
  public partial class RoleLoadSettings 
  {

    public RoleLoadSettings()
    {
      AsReadonly = false;

      OnCreate();
    }

    public bool AsReadonly { get; set; }

    private RoleFilterExpression filter;
    public RoleFilterExpression Filter 
    { 
      get 
      { 
        filter = RoleFilterExpression.FromRoleFilterExpression(filter);
        return filter; 
      }
      set { filter = value; }
    }

    private RoleSelectionSettings selection;
    public RoleSelectionSettings Selection 
    { 
      get 
      { 
        selection = RoleSelectionSettings.FromRoleSelectionSettings(selection);
        return selection; 
      }
      set { selection = value; }
    }

    private RoleInclusionSettings inclusion;
    public RoleInclusionSettings Inclusion 
    { 
      get 
      { 
        inclusion = RoleInclusionSettings.FromRoleInclusionSettings(inclusion);
        return inclusion; 
      }
      set { inclusion = value; }
    }

    private RoleSortingSettings sorting;
    public RoleSortingSettings Sorting 
    { 
      get 
      { 
        sorting = RoleSortingSettings.FromRoleSortingSettings(sorting);
        return sorting; 
      }
      set { sorting = value; }
    }

    private PagingSettings paging;
    public PagingSettings Paging 
    { 
      get 
      { 
        if (paging == null) paging = new PagingSettings();
        return paging; 
      }
      set { paging = value; }
    }

    partial void OnCreate();

    protected virtual void CopyFrom(RoleLoadSettings other)
    {
      if (other != null)
      {
        filter     = other.filter;
        selection  = other.selection;
        sorting    = other.sorting;
        inclusion  = other.inclusion;
        paging     = other.paging;
      }
    }

    public static RoleLoadSettings FromRoleLoadSettings(RoleLoadSettings other)
    {
      if (other != null) return other;
      var result = new RoleLoadSettings();
      return result;
    }

  }

  [Serializable]
  public partial class RoleFilterExpression 
  {
    public RoleKey ByKey { get; set; }

    public int? Skip { get; set; }

    public int? Take { get; set; }

    public SimpleFilterExpression<Guid> RoleIdFilter { get; set; }

    public SimpleFilterExpression<string> NameFilter { get; set; }

    public SimpleFilterExpression<bool> IsAdminFilter { get; set; }

    partial void OnCreate();

    protected virtual void CopyFrom(RoleFilterExpression other)
    {
      if (other != null)
      {
        ByKey = other.ByKey;
        Skip = other.Skip;
        Take = other.Take;
      }
    }

    public static RoleFilterExpression FromRoleFilterExpression(RoleFilterExpression other)
    {
      if (other != null) return other;
      var result = new RoleFilterExpression();
      return result;
    }

  }

  [Serializable]
  public partial class RoleSelectionSettings 
  {
    public RoleSelectionSettings()
    {
      SelectRoleId = true;
      SelectName = true;
      SelectIsAdmin = true;

      OnCreate();
    }

    public bool SelectRoleId { get; set; } 

    public bool SelectName { get; set; } 

    public bool SelectIsAdmin { get; set; } 

    partial void OnCreate();

    protected virtual void CopyFrom(RoleSelectionSettings other)
    {
      if (other != null)
      {
        SelectRoleId = other.SelectRoleId;
        SelectName = other.SelectName;
        SelectIsAdmin = other.SelectIsAdmin;
      }
    }

    public static RoleSelectionSettings FromRoleSelectionSettings(RoleSelectionSettings other)
    {
      if (other != null) return other;
      var result = new RoleSelectionSettings();
      return result;
    }

  }

  [Serializable]
  public partial class RoleInclusionSettings 
  {
    public RoleInclusionSettings()
    {
      OnCreate();
    }

    public bool IncludeSecurableActions { get; set; }
    private SecurableActionLoadSettings includedSecurableActionsSettings;
    public SecurableActionLoadSettings IncludedSecurableActionsSettings 
    { 
      get
      {
        includedSecurableActionsSettings = SecurableActionLoadSettings.FromSecurableActionLoadSettings(includedSecurableActionsSettings);
        return includedSecurableActionsSettings;
      } 
      set
      {
        includedSecurableActionsSettings = value;
      }
    }

    public bool IncludeUsers { get; set; }
    private UserLoadSettings includedUsersSettings;
    public UserLoadSettings IncludedUsersSettings 
    { 
      get
      {
        includedUsersSettings = UserLoadSettings.FromUserLoadSettings(includedUsersSettings);
        return includedUsersSettings;
      } 
      set
      {
        includedUsersSettings = value;
      }
    }


    partial void OnCreate();

    protected virtual void CopyFrom(RoleInclusionSettings other)
    {
      if (other != null)
      {
        IncludeSecurableActions = other.IncludeSecurableActions;
        includedSecurableActionsSettings = other.includedSecurableActionsSettings;
        IncludeUsers = other.IncludeUsers;
        includedUsersSettings = other.includedUsersSettings;
      }
    }

    public static RoleInclusionSettings FromRoleInclusionSettings(RoleInclusionSettings other)
    {
      if (other != null) return other;
      var result = new RoleInclusionSettings();
      return result;
    }

  }

  [Serializable]
  public partial class RoleSortingSettings 
  {
    public RoleSortingSettings()
    {
      OnCreate();
    }


    partial void OnCreate();

    protected virtual void CopyFrom(RoleSortingSettings other)
    {
      if (other != null)
      {
      }
    }

    public static RoleSortingSettings FromRoleSortingSettings(RoleSortingSettings other)
    {
      if (other != null) return other;
      var result = new RoleSortingSettings();
      return result;
    }

  }
}
